//
//  KpListViewController.m
//  SelfDriving
//
//  Created by Kipp Dev on 2017/3/14.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "KpListViewController.h"
#import "BusinessService+FJ.h"
#import "KPDViewController.h"
#import "FriendDetailsMainVC.h"
#import "LoginResponseModel.h"
#import "XLSwitchView.h"
#import "UIButton+IndexPath.h"
#import "UIButton+WebCache.h"
//这才是真正的快拍列表ctrl
@interface KpListViewController ()<UITableViewDataSource,UITableViewDelegate,BaseTableDetelage,UICollectionViewDelegate,UICollectionViewDataSource,UITextViewDelegate,KYExpressionInputViewDelegate,XLSwitchViewDelegate,UINavigationBarDelegate,XhwSenceKpVCDelegate>
//@property (strong, nonatomic) BaseTable *table;

@property (strong, nonatomic) BaseTable *table;

//xhw12月28号加：
@property (strong, nonatomic) NSString *xhwRecordKPid;

@end

@implementation KpListViewController{
    NSMutableArray *data;
    UILabel *notlabel;
    KYExpressionInputView *inputView;
    LoginResponseModel *user;
    LoginResponseModel *models;
    NSString *total;//总人数
    NSString *online;//在线人数
    int isto;
    NSMutableArray<QMUIButton *> *btnArr;
    TCNotify *not;
}

- (void)xhwUpdateZanCount {
    
}

- (void)refreshData {

//    [self initData:1];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    isto = 0;
    self.navigationController.navigationBarHidden = NO;
    [[NSNotificationCenter defaultCenter]
     addObserver:self
     selector:@selector(scollTop:)
     name:@"scollTop"
     object:nil];
    self.navigationController.delegate = self;

}

- (void)viewDidLoad {
    [super viewDidLoad];

    data = [NSMutableArray array];


//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initdata:) name:@"xhwRefreshListData" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(xhwRefreshZancount:) name:@"xhwInit" object:nil];
    [self.view addSubview:self.table];
    
}

- (void)xhwRefreshZancount:(NSNotification *)notify {
    if (self.xhwRecordKPid) {
        NSString *zancount = notify.userInfo[@"zancount"];
        NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
        [dic setObject:self.xhwRecordKPid forKey:@"id"];
        int i = 0;
        for (DTModel *model in data) {
            if ([model.id isEqualToString:self.xhwRecordKPid]) {
                DTModel *newModel = model;
                NSString * oldZancount = model.zancount;
                newModel.zancount = [NSString stringWithFormat:@"%d",[oldZancount intValue] + [zancount intValue]];
                [data removeObject:model];
                [data insertObject:newModel atIndex:i];
                [_table reloadData];
                break;
            }
            i += 1;
        }
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)scollTop:(NSNotification *)not{
    if (data.count!=0) {
        [_table scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
    }
}



-(void)initData:(int)index{
    self.table.backgroundColor = colorBG;
    NSMutableDictionary *dic = [UserDefaults readUserDefaultObjectValueForKey:@"userLocation"];
    [dic setObject:[NSNumber numberWithInt:index] forKey:@"page"];
    [dic setObject:@(self.kptype) forKey:@"type"];
    
    
    [[BusinessService shareInstance]kuaipai_list:dic success:^(id result) {//其中的result是此方法已封装好了的DTModel数组
        data = [_table result:result olddata:data index:index];
        if (notlabel) {
            [notlabel removeFromSuperview];
        }
        notlabel = (UILabel *)[_table notData];//无参数提示
        if (data.count == 0) {
            [self.view addSubview:notlabel];
        }
        [_table reloadData];
    } failure:^(id result) {
        [SVProgressHUD showErrorWithStatus:result];
    }];
}


-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return data.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
    return cell.frame.size.height;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    //xhw11月24号加
    for (UIView* view in cell.contentView.subviews) {
        [view removeFromSuperview];
    }
    //    cell.backgroundColor = colorBG;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    DTModel *model = [data objectAtIndex:indexPath.section];
    UIView *bgview= [[UIView alloc]initWithFrame:CGRectMake(0, 20, SCRE_WIDTH, 300)];
    //基础UI
    int b = [_table Basics:cell dtmodel:model bgview:bgview];//baseTable的方法，里面设置了头像和用户昵称以及是否显示vip图标和发布的时间
    //个人头像按钮
    UIButton *headbtn = [[UIButton alloc]initWithFrame:CGRectMake(20, 10, 45, 45)];
    headbtn.tag = indexPath.section;
    [headbtn addTarget:self action:@selector(toIndividualAction:) forControlEvents:UIControlEventTouchUpInside];
    [cell.contentView addSubview:headbtn];
    int file = 0;
    
    
    
    //附件
    if (model.img!=nil) {
        //        model.img = model.headsmall;
        file = [_table Attachment:cell dtmodel:model bgview:bgview];
        NSString *url = model.img;
        if ([url trim].length !=0) {
            url = [url substringFromIndex:url.length-3];
        }
        
        
        // 就是video
        if(model.video.length!=0){
            
            //附件按钮
            // 设置成第一帧
            BaseButton *headbtn = [[BaseButton alloc]initWithFrame:CGRectMake(0,45, SCRE_WIDTH, file)];
            headbtn.tag = indexPath.section;
//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//                UIImage *videoImg = [self getVideoPreViewImageWithUrl:[@"http://yimisns.com" stringByAppendingString:model.video]];
//                dispatch_async(dispatch_get_main_queue(), ^{
//                    [headbtn setImage:videoImg forState:UIControlStateNormal];
//                });
//            });

            [headbtn sd_setImageWithURL:[NSURL URLWithString:model.img] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"图标---视频播放"]];
//            [headbtn setImage:[UIImage imageNamed:@"图标---视频播放"] forState:UIControlStateNormal];
            
            
            
            
            
            headbtn.index = indexPath.section;
            [headbtn addTarget:self action:@selector(btntoKPDViewController:) forControlEvents:UIControlEventTouchUpInside];
            [bgview addSubview:headbtn];
            
            UIView *bgviews = [[UIView alloc]initWithFrame:CGRectMake(SCRE_WIDTH - 70, 55, 60, 20)];
            bgviews.backgroundColor = UIColorMakeWithRGBA(0, 0, 0, 0.3);
            bgviews.layer.masksToBounds = YES;
            bgviews.layer.borderWidth = 1;
            bgviews.layer.borderColor = UIColorWhite.CGColor;
            bgviews.layer.cornerRadius = 10;
            [bgview addSubview:bgviews];
            
        
            UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 60, 20)];
            lable.text = @"现场";  //根据是否有video来判断是现场还是快拍,有video则为现场
            lable.layer.cornerRadius = 10;
            lable.clipsToBounds = YES;
            lable.textAlignment = NSTextAlignmentCenter;
            //现场、快拍字样--如有新的评论印记白色字体变红。(xhw11月10号加)
            
            if ([model.hasunread intValue] == 0) {
                lable.textColor = [UIColor whiteColor];
            }
            else {
                lable.textColor = [UIColor redColor];
            }
            
            lable.font = [UIFont systemFontOfSize:15];
            [bgviews addSubview:lable];
        }else{
            UIView *bgviews = [[UIView alloc]initWithFrame:CGRectMake(SCRE_WIDTH - 70, 55, 60, 20)];
            bgviews.backgroundColor = UIColorBlack;
            bgviews.alpha = 0.3;
            bgviews.layer.cornerRadius = 10;
            bgviews.layer.masksToBounds = YES;
            bgviews.layer.borderWidth = 1;
            
            bgviews.layer.borderColor = UIColorWhite.CGColor;
            
            [bgview addSubview:bgviews];
            
            
            UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 60, 20)];
            lable.text = @"快拍";
            lable.layer.cornerRadius = 10;
            lable.clipsToBounds = YES;
            
            lable.textAlignment = NSTextAlignmentCenter;
            if ([model.hasunread intValue] == 0) {
                lable.textColor = [UIColor whiteColor];
            }
            else {
                lable.textColor = [UIColor redColor];
            }
            lable.font = [UIFont systemFontOfSize:15];
            [bgviews addSubview:lable];
        }
    }
    
    // 6月9日：添加删除按钮
    if (self.kptype == 6) {
        [bgview addSubview:({
            UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
            CGFloat Y;
            if (SCRE_WIDTH == 375) {
                Y = CGRectGetMaxY(bgview.frame)+50;
            }else if (SCRE_WIDTH == 414) {
                Y = CGRectGetMaxY(bgview.frame)+60;
            }else {
                Y = CGRectGetMaxY(bgview.frame)+10;
            }
            btn.frame = CGRectMake(SCRE_WIDTH - 70,Y, 60, 20);
            [btn setTitle:@"删除" forState:UIControlStateNormal];
            [btn addTarget:self action:@selector(deleteCell:) forControlEvents:UIControlEventTouchUpInside];
            [btn.titleLabel setFont:[UIFont systemFontOfSize:15]];
            [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            btn.backgroundColor = [UIColor darkGrayColor];
            btn.layer.cornerRadius = 10;
            btn.layer.borderColor = [UIColor whiteColor].CGColor;
            btn.layer.borderWidth = 1.f;
            btn.indexPath = indexPath;
            btn;
        })];
    }
    //内容
    MLEmojiLabel * _emojiLabel = [MLEmojiLabel new];
    _emojiLabel.numberOfLines = 0;
    _emojiLabel.font = [UIFont systemFontOfSize:15.0f];
    _emojiLabel.backgroundColor = [UIColor clearColor];
    _emojiLabel.lineBreakMode = NSLineBreakByWordWrapping;
    _emojiLabel.textColor = [UIColor blackColor];
    
    _emojiLabel.textInsets = UIEdgeInsetsMake(0, 5, 0, 5);
    
    _emojiLabel.isNeedAtAndPoundSign = YES;
    _emojiLabel.disableEmoji = NO;
    _emojiLabel.disableThreeCommon = YES;
    //    _emojiLabel.lineSpacing = 3.0f;
    
    _emojiLabel.verticalAlignment = TTTAttributedLabelVerticalAlignmentCenter;
    _emojiLabel.customEmojiRegex = @"\\[[emoji_[0-9]{1,3}]+\\]";
    _emojiLabel.customEmojiPlistName = @"expressionImage_custom.plist";
    [_emojiLabel setText:model.title];
    
    CGRect g = _emojiLabel.frame;
    g.size.height = ([_emojiLabel preferredSizeWithMaxWidth:bgview.frame.size.width].height+10.0f*2);
    g.origin.y =  b+file;
    g.size.width = SCRE_WIDTH-10;
    g.origin.x = 0;
    _emojiLabel.frame = g;
    [bgview addSubview:_emojiLabel];
    int conth = _emojiLabel.frame.size.height;
    //内容下线
    UILabel *ine = [[UILabel alloc]initWithFrame:CGRectMake(10, b+file+conth,SCRE_WIDTH-40,0.5)];
    ine.backgroundColor = colorBG;
    [bgview addSubview:ine];
    
    
    //底部
    int bottom = b+file+conth;
    UIButton *zanbtn = [[UIButton alloc]initWithFrame:CGRectMake(10, bottom, 120, 30)];
    //    [zanbtn setImage:[UIImage imageNamed:@"zan"] forState:UIControlStateNormal];
    [zanbtn setTitleColor:colorGrey forState:UIControlStateNormal];
    zanbtn.titleLabel.font = [UIFont systemFontOfSize:13];

    [zanbtn setTitle:[NSString stringWithFormat:@"❤︎%@次赞",model.zancount] forState:UIControlStateNormal];
    zanbtn.tag = indexPath.section;
    [zanbtn addTarget:self action:@selector(praiseAction:) forControlEvents:UIControlEventTouchUpInside];
    
    
    [zanbtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
    
    [bgview addSubview:zanbtn];
    
    
    
    
    
    CGRect bg = bgview.frame;
    bg.size.height = bottom + 30;
    bgview.frame = bg;
    
    CGRect cl =  cell.frame;
    cl.size.height = bottom + 50;
    cell.frame = cl;
    return cell;
}
-(void)btntoKPDViewController:(BaseButton *)btn{
    DTModel *model = [data objectAtIndex:btn.index];
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
    [dic setObject:model.id forKey:@"id"];
    [SVProgressHUD showWithStatus:@"加载中..."];
    [[BusinessService shareInstance]kuaipai_detail:dic success:^(id result) {
        user = result;
        [[BusinessService shareInstance]enterGroup:dic success:^(id result) {
            [SVProgressHUD dismiss];
            models = result;
            UIStoryboard *customerStoryboard = [UIStoryboard storyboardWithName:@"FJ"
                                                                         bundle:[NSBundle mainBundle]];
            KPDViewController *searchResultDetailController = [customerStoryboard instantiateViewControllerWithIdentifier:@"KPDViewController"];
            searchResultDetailController.model = models;
            searchResultDetailController.user = user;
            searchResultDetailController.ary = data;
            searchResultDetailController.notify = not;
            searchResultDetailController.index = btn.index;
            searchResultDetailController.modelId = model.id;
            if (self.nav) {
                [self.nav pushViewController:searchResultDetailController animated:YES];
            }else{
                [self.navigationController pushViewController:searchResultDetailController animated:YES];
            }
            
            
            
        } failure:^(id result) {
            [SVProgressHUD showErrorWithStatus:result];
        }];
    } failure:^(id result) {
        [SVProgressHUD showErrorWithStatus:result];
    }];
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initdata:) name:@"initdataren" object:nil];
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    DTModel *model = [data objectAtIndex:indexPath.section];
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
    [dic setObject:model.id forKey:@"id"];
    [SVProgressHUD showWithStatus:@"加载中..."];
    
    [[BusinessService shareInstance]kuaipai_detail:dic success:^(id result) {
        user = result;
        [[BusinessService shareInstance]enterGroup:dic success:^(id result) {
            [SVProgressHUD dismiss];
            models = result;
            UIStoryboard *customerStoryboard = [UIStoryboard storyboardWithName:@"FJ"
                                                                         bundle:[NSBundle mainBundle]];
            KPDViewController *searchResultDetailController = [customerStoryboard instantiateViewControllerWithIdentifier:@"KPDViewController"];
            searchResultDetailController.model = models;
            searchResultDetailController.user = user;
            searchResultDetailController.ary = data;
            searchResultDetailController.notify = not;
            searchResultDetailController.modelId = model.id;
            searchResultDetailController.index = indexPath.section;
            if (self.nav) {
                [self.nav pushViewController:searchResultDetailController animated:YES];
            }else{
                [self.navigationController pushViewController:searchResultDetailController animated:YES];
            }
            
            
        } failure:^(id result) {
            [SVProgressHUD showErrorWithStatus:result];
        }];
    } failure:^(id result) {
        [SVProgressHUD showErrorWithStatus:result];
    }];
}
-(void)initdata:(NSNotification *)sender{
    not = sender.object;
    //xhw12月28号加:正真解决 点赞后外面的赞数自动更新下
    [self initData:1];
}
#pragma mark   赞
- (IBAction)praiseAction:(UIButton *)sender {
    //    inputView.hidden = NO;
    //    [inputView removeFromSuperview];
    //    inputView = [[KYExpressionInputView alloc] init];
    //    inputView.frame = CGRectMake(0, SCRE_HEIGHT-inputView.frame.size.height+5, SCRE_WIDTH, inputView.frame.size.height);
    //    inputView.toolbarColor = [UIColor whiteColor];
    //    inputView.backgroundColor = [UIColor whiteColor];
    //    inputView.tag = sender.tag;
    //    inputView.toolbar.hidden = YES;
    //    [inputView setToolbarSendButtonHidden:YES animated:NO];
    //    [inputView addToolbarItemWithImage:nil title:nil items:[AppDelegate shareDelegate].emojiItems row:KYUIntegerOrientationMake(4, 5) column:KYUIntegerOrientationMake(8, 14) itemSize:KYSizeOrientationMake(CGSizeMake(36, 36), CGSizeMake(36, 36)) itemSpacing:KYFloatOrientationMake(6, 8)];
    //    inputView.delegate = self;
    //    [[[[UIApplication sharedApplication] windows] firstObject] addSubview:inputView];
    
    DTModel *msg = [data objectAtIndex:sender.tag];
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
    if ([msg.iszan intValue]==0) {
        [dic setObject:@"1" forKey:@"type"];
    }else{
        [dic setObject:@"0" forKey:@"type"];
    }
    [dic setObject:msg.id forKey:@"id"];
    [dic setObject:@"emoji_52" forKey:@"content"];
    [[BusinessService shareInstance]praise:dic success:^(id result) {
        if ([msg.iszan intValue]==0) {
            msg.zancount = [NSString stringWithFormat:@"%d",[msg.zancount intValue]+1];
        }else{
            msg.zancount = [NSString stringWithFormat:@"%d",[msg.zancount intValue]-1];
        }
        if ([msg.iszan intValue]==0) {
            msg.iszan = @"1";
        }else{
            msg.iszan = @"0";
        }
        [data removeObjectAtIndex:inputView.tag];
        [data insertObject:msg atIndex:inputView.tag];
        [_table reloadData];
        [inputView removeFromSuperview];
        
    } failure:^(id result) {
        [SVProgressHUD showErrorWithStatus:result];
    }];
}
- (void)inputView:(KYExpressionInputView *)inputView didSelectExpression:(id<KYExpressionData>)expression {
    //    DTModel *msg = [data objectAtIndex:inputView.tag];
    //    NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
    //    if ([msg.iszan intValue]==0) {
    //        [dic setObject:@"1" forKey:@"type"];
    //    }else{
    //        [dic setObject:@"0" forKey:@"type"];
    //    }
    //    [dic setObject:msg.id forKey:@"id"];
    //    [dic setObject:@"emoji_52" forKey:@"content"];
    //    [[BusinessService shareInstance]praise:dic success:^(id result) {
    //        if ([msg.iszan intValue]==0) {
    //            msg.zancount = [NSString stringWithFormat:@"%d",[msg.zancount intValue]+1];
    //        }else{
    //            msg.zancount = [NSString stringWithFormat:@"%d",[msg.zancount intValue]-1];
    //        }
    //        if ([msg.iszan intValue]==0) {
    //            msg.iszan = @"1";
    //        }else{
    //            msg.iszan = @"0";
    //        }
    //        [data removeObjectAtIndex:inputView.tag];
    //        [data insertObject:msg atIndex:inputView.tag];
    //        [_table reloadData];
    //        [inputView removeFromSuperview];
    //
    //    } failure:^(id result) {
    //        [SVProgressHUD showErrorWithStatus:result];
    //    }];
}
#pragma mark 个人信息
- (IBAction)toIndividualAction:(UIButton *)sender {
    DTModel *model = [data objectAtIndex:sender.tag];
    
    UIStoryboard *customerStoryboard = [UIStoryboard storyboardWithName:@"MS"
                                                                 bundle:[NSBundle mainBundle]];
    FriendDetailsMainVC *searchResultDetailController = [customerStoryboard instantiateViewControllerWithIdentifier:@"FriendDetailsMainVC"];
    searchResultDetailController.model = model;
    [self.nav pushViewController:searchResultDetailController animated:YES];
    
    
}
-(BaseTable *)table{
    if (!_table) {
        _table = [[BaseTable alloc]init];
        _table.bdelegate = self;
        _table.delegate = self;
        _table.dataSource = self;
        _table.frame = self.view.frame;
        
        
    }
    return _table;
}

- (IBAction)backAction:(id)sender {
    if (self.nav) {
        [self.nav popViewControllerAnimated:YES];
    }else{
    [self.navigationController popViewControllerAnimated:YES];
    }
    
    
}

#pragma mark - 获取第一帧
- (UIImage*) getVideoPreViewImageWithUrl:(NSString *)videoPath
{
    AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL URLWithString:videoPath] options:nil];
    AVAssetImageGenerator *gen = [[AVAssetImageGenerator alloc] initWithAsset:asset];
//    [asset release];
    gen.appliesPreferredTrackTransform = YES;
    CMTime time = CMTimeMakeWithSeconds(0.0, 600);
    NSError *error = nil;
    CMTime actualTime;
    CGImageRef image = [gen copyCGImageAtTime:time actualTime:&actualTime error:&error];
    UIImage *img = [[UIImage alloc] initWithCGImage:image] ;
    CGImageRelease(image);
//    [gen release];
    return img;
}

#pragma mark - 删除cell
- (void)deleteCell:(UIButton *)sender {
    
    DTModel *model = [data objectAtIndex:sender.indexPath.row];

    [SVProgressHUD showWithStatus:@"删除中..."];
    [[BusinessService shareInstance] kuaipai_delete:[@{@"kid":model.id,
                                                       @"uid":model.uid} mutableCopy]
     success:^(id result) {
    
         [SVProgressHUD showSuccessWithStatus:@"删除成功"];
         NSLog(@"删除的东西--->%@",result);
         
         // 1.动画
//         [_table deleteRowsAtIndexPaths:@[sender.indexPath] withRowAnimation:UITableViewRowAnimationRight];
         
         // 2.数据源
         [data removeObjectAtIndex:sender.indexPath.row];
         [self.table reloadData];
         
} failure:^(id result) {
    
    [SVProgressHUD showErrorWithStatus:result];
}];
//    [[BusinessService shareInstance]praise:[@{@"kid":model.id} mutableCopy] success:^(id result) {
//        if ([msg.iszan intValue]==0) {
//            msg.zancount = [NSString stringWithFormat:@"%d",[msg.zancount intValue]+1];
//        }else{
//            msg.zancount = [NSString stringWithFormat:@"%d",[msg.zancount intValue]-1];
//        }
//        if ([msg.iszan intValue]==0) {
//            msg.iszan = @"1";
//        }else{
//            msg.iszan = @"0";
//        }
//        [data removeObjectAtIndex:inputView.tag];
//        [data insertObject:msg atIndex:inputView.tag];
//        [_table reloadData];
//        [inputView removeFromSuperview];
//        
//    } failure:^(id result) {
//        [SVProgressHUD showErrorWithStatus:result];
//    }];

    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
